# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-cerberus
pkgver=1.3.4
pkgrel=6
pkgdesc="Lightweight, extensible schema and data validation tool for Python dictionaries"
url="https://github.com/pyeve/cerberus"
license=('ISC')
arch=('any')
depends=('python' 'python-setuptools')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest-runner' 'python-pytest-benchmark')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha512sums=('c816b426ed1b32367d1e8f1c26d6ddd4b49c6578540e688baf693e3094a05800f645cfe879be6378c1e9be9899cad7bc2ad1ed9844d6762d2ef6e0cc54a7476a')
b2sums=('6fabfcf32e26ee7f4881b64ce9c3098a27949d95fd0998e09b7adcc3b834033f904a07b6e9b2cadea218b952142f6c2bc6051d8c208a14d6e8172a0c3823c38b')

build() {
  cd cerberus-$pkgver
  python -m build --wheel --no-isolation
  # NOTE: remove build dir as pytest otherwise chokes on duplicate imports
  rm -frv build
}

check() {
  cd cerberus-$pkgver
  pytest -vv
}

package() {
  cd cerberus-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
